/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package lesson3.com.demo.inner.anon;

import lesson3.com.demo.inner.local.*;
import lesson3.com.demo.inner.member.*;
import lesson3.com.demo.inner.not.*;

// called a "top-level" class, can be public or p-f ONLY
public class Car {
    
    private float fuelLevel;
    private Engine eng;
    

    public Engine createEngine(){
        if(eng!=null){
            return eng;
        }
                            // my anon inner class extends Object implements Engine
        return new Engine() {  // start of anon inner class

            @Override
            public void rev() {
                fuelLevel-=0.05F;
            }
            
        }// end of the anon inner class
        ; // end of the return statement
    }
    
    public void run(){
        // affect fuelLevel;
        fuelLevel-=0.02F;
    }
    
    public void addGas(float amount, double moneyMoneyMoney)
    {
        // check money... THEN
        fuelLevel+=amount;
    }
    
    public float siphonTankForLawnMower(float  amount){
        fuelLevel-=amount;
        return fuelLevel;
    }
    
    public float getFuelLevel(){
        return fuelLevel;
    }
    
   
    

}
